<template>
	<el-input
		v-model="dataValue"
		:placeholder="placeholder"
		:type="type"
		:disabled="disabled"
		@input="selfValueChange"
		autocomplete="new-password"
	></el-input>
</template>
<script type="text/javascript">
import stringMixin from './stringMixin'
import Mtils from 'mtils'
// import BIN from 'bankcardinfo'
export default {
	name: 'xh-bank', // 银行卡号
	mixins: [stringMixin],
	computed: {
		type() {
			return 'number'
		},
		placeholder() {
			var { placeholder } = this.item || {}
			return placeholder || '请输入银行账号'
		}
	},
	methods: {
		async selfValueChange(val) {
			this.valueChange(val)

			/* 触发事件自动更改银行卡号 */
			// dominate 要更改的字段名
			const { dominate } = this.item
			if (dominate) {
				const isBankCard = Mtils.validation.isBankCard(val)
				if (isBankCard) {
					// BIN.getBankBin(val)
					// 	.then(({ bankName }) => {
					// 		this.$bus.$emit('auto-fill', {
					// 			dominate,
					// 			value: bankName
					// 		})
					// 	})
					// 	.catch(() => {})
				}
			}
		}
	}
}
</script>
<style lang="scss" scoped></style>
